package game;

import java.awt.Graphics2D;
import java.awt.geom.Point2D;

public class ParColchete 
{
	private Colchete colcheteESQ;	
	private Colchete colcheteDIR;
	private Point2D size2 = new Point2D.Double(20, 100);
	private Point2D size3 = new Point2D.Double(20, 150);
	private int distancia;
	private Point2D size;
	
	
	
	public int getDistancia() {
		return distancia;
	}

	public void setDistancia(int distancia) {
		this.distancia = distancia;
		colcheteDIR.setPosition(new Point2D.Double(colcheteESQ.getPosition().getX() + (distancia - size.getX()) , colcheteESQ.getPosition().getY()));
	}

	public Point2D getSize() {
		return size;
	}

	public void setSize(Point2D size) {
		this.size = size;
	}

	public Colchete getColcheteESQ() {
		return colcheteESQ;
	}

	public Colchete getColcheteDIR() {
		return colcheteDIR;
	}
	
	public ParColchete(int tipoColchete, int distancia, Point2D position)
	{
		this.distancia = distancia;
		String image;
		if(tipoColchete == 2)
		{
			size = size2;
			image = "/images/ColchetePQ.png";
		}
		else 
		{
			size = size3;
			image = "/images/ColcheteGR.png";
		}
		
		colcheteESQ = new Colchete(image, 	new Point2D.Double(position.getX(), position.getY()),
											new Point2D.Double(size.getX()*2, size.getY()),
											new Point2D.Double(0, 0),
											new Point2D.Double(size.getX(), size.getY()));

		colcheteDIR = new Colchete(image, 	new Point2D.Double(position.getX() + (distancia - size.getX()) , position.getY()),
											new Point2D.Double(size.getX()*2, size.getY()),
											new Point2D.Double(size.getX(), 0),
											new Point2D.Double(size.getX(), size.getY()));
	}

	public void MudarPosicao(Point2D pos)
	{
		colcheteESQ.setPosition(pos);
		setDistancia(distancia);
	}
	
	public void draw(Graphics2D g2d)
	{
		this.colcheteDIR.draw(g2d);
		this.colcheteESQ.draw(g2d);
	}
}
